shorthand: Only unset values that are set
authorBenjamin Otte <otte@redhat.com>
Tue, 31 Jan 2012 02:59:32 +0000 (03:59 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 31 Jan 2012 02:59:32 +0000 (03:59 +0100)
Otherwise g_value_unset() complains. And that breaks the testsuite.

gtk/gtkcssshorthandproperty.c

index c74ddaea07bac6312ad273f02d11d1a4907c1ad0..0dcfff0cad64ccc7ed13731987054e5c35aeca22 100644 (file)
@@ -84,6 +84,13 @@ _gtk_css_shorthand_property_query (GtkStyleProperty   *property,
   shorthand->query (shorthand, value, query_func, query_data);
 }
 
+static void
+gtk_css_shorthand_property_unset_value (gpointer value)
+{
+  if (G_IS_VALUE (value))
+    g_value_unset (value);
+}
+
 static gboolean
 gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
                                         GValue           *value,
@@ -95,7 +102,7 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
   guint i;
 
   array = g_array_new (FALSE, TRUE, sizeof (GValue));
-  g_array_set_clear_func (array, (GDestroyNotify) g_value_unset);
+  g_array_set_clear_func (array, gtk_css_shorthand_property_unset_value);
   g_array_set_size (array, shorthand->subproperties->len);
 
   if (_gtk_css_parser_try (parser, "initial", TRUE))